#include<string.h>
#include<stdio.h>
char *getIp(const char *qquin,const char *ippolicy);
int isInRange(const char *range,const char *dbsuffix);
int main()
{
	char *qquin="1";
	char *ippolicy="192.168.1.100:0-4|192.168.1.101:5-9";
	printf("%s\n",getIp("1",ippolicy));
}
char *getIp(const char *dbsuffix,const char *ippolicy)
{
	int cindex=0;
	char ip[16],range[200];
	while(ippolicy[cindex] != '\0')
	{
		int ip_start=cindex,ip_end=cindex;
		int range_start=cindex,range_end=cindex;
		while(ippolicy[cindex] != ':')cindex++;
		ip_end=cindex;
		range_start=cindex+1;
		while(ippolicy[cindex] != '|' && ippolicy[cindex] != '\0') cindex++;
		range_end=cindex;
		strncpy(range,&ippolicy[range_start],range_end-range_start);
		range[range_end-range_start]='\0';
		if(isInRange(range,dbsuffix))
		{
			strncpy(ip,&ippolicy[ip_start],ip_end-ip_start);
			ip[ip_end]='\0';
			break;
		}
	}
	return strdup(ip);
}
int isInRange(const char *range,const char *dbsuffix)
{
	return 1;
}

